package org.tissou.client.Panel_Premier.gestion_tab;

import org.tissou.client.Interface.Base_Panel;
import org.tissou.client.Panel_Premier.gestion_tab.Operations_de_gestion.Nouvelle_Categorie;
import com.google.gwt.user.client.ui.*;

/**
 * Created by IntelliJ IDEA.
 * User: Claire
 * Date: 27-Apr-2009
 * Time: 22:41:04
 * To change this template use File | Settings | File Templates.
 */
public class TAB_Gestion extends Base_Panel {
  DockPanel principal = new DockPanel();
  final VerticalPanel radiobuttons = new VerticalPanel();
  VerticalPanel gestion = new VerticalPanel();
  final RadioButton ajout_categorie = new RadioButton("Choix", "Nouvelle Categorie");

  protected void MiseEnPlaceStyles() {
    //To change body of implemented methods use File | Settings | File Templates.
  }

  protected void MiseEnPlaceParametresWidgets() {
    radiobuttons.addStyleName("operationradiobuttons");
    ajout_categorie.addStyleName("defaultstyle");
  }

  protected void MiseEnPlaceParametresPanel() {
    radiobuttons.add(ajout_categorie);
  }

  protected void MiseEnPlaceActions() {
       ClickListener afficheLeBonPanel = new ClickListener() {
      public void onClick(Widget sender) {
        gestion.clear();
        RadioButton rb = (RadioButton)sender;
        if ("Nouvelle Categorie".equals(rb.getText())){
            Nouvelle_Categorie nc_panel = new Nouvelle_Categorie();
            nc_panel.afficherDans(gestion);
        }

      }
    };
    ajout_categorie.addClickListener(afficheLeBonPanel);
  }

  protected void MiseEnPlacePanels() {
    principal.add(radiobuttons, DockPanel.WEST);
    principal.add(gestion, DockPanel.WEST);
    principal.setCellHeight(gestion, "100%");
    principal.setCellWidth(gestion, "100%");
  }

  protected Panel donneLePanelPrincipal() {
    return principal;  //To change body of implemented methods use File | Settings | File Templates.
  }
}